package cate.game.role.res.goldmall.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBGoldMall;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "金币商店购买 の 请求")
@OperationSetter(GDOperation.GOLD_MALL_BUY)
public class GoldMallBuyReq implements MsgInput {
    @NoteField(value = "宝箱id")
    public int boxId;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = cc.getRole().getRes().goldMall.buy(boxId);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBGoldMall.BUY_REQ;
    }
}
